<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('背景信息')"/>
    <th:block th:include="include :: layout-latest-css"/>
    <th:block th:include="include :: ztree-css"/>
    <th:block th:include="include :: select2-css"/>
</head>
<body class="gray-bg">
<div class="ui-layout-west">
    <div class="box box-main">
        <div class="box-header">
            <div class="box-title">
                <i class="fa icon-grid"></i> 背景信息菜单
            </div>
            <div class="box-tools pull-right">
                <button type="button" class="btn btn-box-tool" id="btnExpand" title="展开" style="display:none;"><i
                        class="fa fa-chevron-up"></i></button>
                <button type="button" class="btn btn-box-tool" id="btnCollapse" title="折叠"><i
                        class="fa fa-chevron-down"></i></button>
                <button type="button" class="btn btn-box-tool" id="btnRefresh" title="刷新部门"><i
                        class="fa fa-refresh"></i></button>
            </div>
        </div>
        <div class="ui-layout-content">
            <div id="tree" class="ztree"></div>
        </div>
    </div>
</div>
<div class="ui-layout-center">
    <iframe id="bgInfo" src="bgInfo/welcome" scrolling="no"
            style="border: none;width: 100%;height: 100%"></iframe>
</div>

<th:block th:include="include :: footer"/>
<th:block th:include="include :: layout-latest-js"/>
<th:block th:include="include :: ztree-js"/>
<th:block th:include="include :: select2-js"/>
<th:block th:include="include :: datetimepicker-js"/>

<script th:inline="javascript">
    $(function () {
        var panehHidden = false;

        if ($(this).width() < 800) {
            panehHidden = true;
        }
        $('body').layout({initClosed: panehHidden, west__size: 260});
        getTreeData();
    });

    function getTreeData() {
        var url = ctx + "bgInfo/treeData";
        var options = {
            url: url,
            expandLevel: 2,
            onClick: zOnClick
        };
        $.tree.init(options);

        function zOnClick(event, treeId, treeNode) {
            var src = "";
            var pageNum = treeNode.id;
            if (pageNum == 101) {
                //员工基本信息
                src = ctx + "bgInfo/basicEmpInfo";
            }else if(pageNum == 102){
                //员工详细信息
                src = ctx + "bgInfo/detailedEmpInfo";
            }else if(pageNum == 104){
                //教育经历
                src = ctx + "bgInfo/education";
            }else if(pageNum == 105){
                //工作经历
                src = ctx + "bgInfo/work";
            }else if(pageNum == 106){
                //职称/资格证书
                src = ctx + "bgInfo/title";
            }else if(pageNum == 107){
                //培训经历
                src = ctx + "bgInfo/train";
            }else if(pageNum == 108){
                //项目经历
                src = ctx + "bgInfo/project";
            }else if(pageNum == 109){
                //惩奖经历
                src = ctx + "bgInfo/punReward";
            }else if(pageNum == 110){
                //家庭背景
                src = ctx + "bgInfo/family";
            }else if(pageNum == 111){
                //紧急联系人
                src = ctx + "bgInfo/contacts";
            }else if(pageNum == 112){
                //证件管理
                src = ctx + "bgInfo/certificates";
            }else if(pageNum == 113){
                //语言能力
                src = ctx + "bgInfo/language";
            }
            $("#bgInfo").attr({
                "src": src
            });
        }
    }
</script>
</body>
</html>